<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue@next"></script>
  <style>
    .component-fade-enter-active,
    .component-fade-leave-active {
      transition: opacity 0.3s ease;
    }

    .component-fade-enter-from,
    .component-fade-leave-to {
      opacity: 0;
    }
  </style>
</head>
<body>
  <div id="app">
    <input type="radio" v-model="view" value="v-a" id="a"><label for="a">A</label>
    <input type="radio" v-model="view" value="v-b" id="b"><label for="b">B</label>
    <transition name="component-fade" mode="out-in">
      <component :is="view"></component>
    </transition>
  </div>

  <script>
    const app = Vue.createApp({
      setup() {
        let view = Vue.ref('v-a')
        return {
          view
        }
      }
    })

    app.component('v-a', {
      template: `<div>Component A</div>`
    })
    app.component('v-b', {
      template: `<div>Component B</div>`
    })

    app.mount('#app')
  </script>
</body>
</html>